home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 23 / AACD 23.iso / AACD / Utilities / BareED / rexx / RemInvalidChars.rx < prev    next >
Text File  |  2000-02-05  |  2KB  |  73 lines

  1. /*
  2.  This  script  is to eleminate invalid charcaters that will cause sometimes on
  3.  an  AMIGA  unexpected  result.  BareED  allows to use any characters in range
  4.  from  1  to  255,  but some applications (e.g. gcc - the GNU C compiler) have
  5.  got  problems  with it. So this script will exchange the characters from 1 to
  6.  8,  11  to  26,  28  to  31  and  128  to  159  through a simple string, e.g.
  7.  '»»replaced number 25 through this««'.
  8. */
  9.  
  10. BAREED_HOST = GetClip('BAREED')
  11.  
  12. IF BAREED_HOST = '' THEN DO
  13.     CALL SetClip('BAREED')    /* Remove from ClipNode */
  14.     EXIT 5
  15.     END
  16.  
  17. ADDRESS VALUE BAREED_HOST
  18.  
  19. CALL SetClip('BAREED')        /* Remove from ClipNode */
  20.  
  21. OPTIONS RESULTS
  22.  
  23. /* ------------------- MAIN ---------------- */
  24.  
  25. 'set echo off'
  26. activate window
  27. lock on
  28.  
  29. repchar = 1
  30. reps = 0
  31. set findmode
  32.  
  33. tell "Going to replace invalid strings."'0a'x"This can take its time."'0a'x'0a'x"Please have patience."
  34.  
  35. do while repchar < 32
  36.     set find string d2c( repchar)
  37.     set replace string "»»replaced number" repchar "through this««"
  38.     move cursor archivestart
  39.  
  40.     do while rc = 0
  41.         if repchar == 9 | repchar == 10 | repchar == 27 then    /* Ignore tab, lf and esc */
  42.             break
  43.         find next string
  44.         if rc = 0 then do
  45.             replace next
  46.             reps = reps + 1
  47.         end
  48.     end
  49.  
  50.     repchar = repchar + 1
  51. end
  52.  
  53. repchar = 128
  54.  
  55. do while repchar < 160
  56.     set find string d2c( repchar)
  57.     set replace string "»»replaced number" repchar "through this««"
  58.     move cursor archivestart
  59.  
  60.     do while rc = 0
  61.         find next string
  62.         if rc = 0 then do
  63.             replace next
  64.             reps = reps + 1
  65.         end
  66.     end
  67.  
  68.     repchar = repchar + 1
  69. end
  70.  
  71. lock off
  72. tell "Replaced" reps "invalid (non AMIGA like) number(s) through string(s)."'0a'x"Those strings are introduced by the text: '»»replaced'"
  73.